<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <script src="js/axios.min.js"></script>
</head>
<body>
  <div>
    <input type="text" readonly v-model="product.id">
    <input type="text" placeholder="请输入标题" v-model="product.title">
    <input type="text" placeholder="请输入价格" v-model="product.price">
    <input type="text" placeholder="请输入销量" v-model="product.saleCount">
    <input type="button" value="更改"@click="update()">
  </div>
<script src="js/vue.js"></script>
<script src="js/axios.min.js"></script>
<script>
    let  v = new Vue({
      el:'div',
      data:{
             product:{}
      },
      created:function () {
         let id = location.search.split("=")[1];
         axios.get("/selectById?id="+id).then(function (response) {
           v.product = response.data;
         })

      },methods:{
          update(){
              axios.post("/insert",v.product).then(function (response) {
                  alert("更改成功")
                  location.href="/select.html"
              })
          }
        }
    })
</script>
</body>
</html>